﻿using DevExpress.XtraEditors;
using DXApplicationTangche.UC.圣同润.Service;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DXApplicationTangche.UC.圣同润
{
    public partial class Form商品信息 : DevExpress.XtraEditors.XtraForm
    {
        private List<PictureVO> pictureVOs = new List<PictureVO>();
        public Form商品信息(String productId)
        {
            InitializeComponent();
            this.getData(productId);
            //this.getData("3uTHsOA7TcuLiEpLuGEbKQ7ezFMRAv2-");
        }

        public void getData(String productId)
        {
            //  基础信息
            ProductInfo productInfo = 
                圣同润Service.getProductInfo(productId);
            ProductInfoVO productInfoVO = new ProductInfoVO(productInfo);
            this.textBox昨日销量.Text = productInfoVO.order_count;
            this.textBox昨日浏览.Text = productInfoVO.day_pv_count;
            this.textBox店名.Text = productInfoVO.shop_name;
            this.textBox品牌名.Text = productInfoVO.brand_name;
            this.textBox商品一级分类.Text = productInfoVO.first_cname;
            this.textBox商品二级分类.Text = productInfoVO.second_cname;
            this.textBox商品三级分类.Text = productInfoVO.third_cname;
            this.textBox商品名.Text = productInfoVO.title;
            this.textBox三十日销量.Text = productInfoVO.day30_volume_text;
            this.textBox评论总数.Text = productInfoVO.comment_count;
            this.textBox抖音总转化率.Text = productInfoVO.douyin_conversion_rate;
            this.textBox月转化率.Text = productInfoVO.month_conversion_rate;
            this.textBox月直播总场次.Text = productInfoVO.live_nearly_month_count;
            this.textBox市场价.Text = productInfoVO.regular_price;
            this.textBox最高价.Text = productInfoVO.max_price;
            this.textBox零售价.Text = productInfoVO.price;
            this.textBox最终价.Text = productInfoVO.final_price;
            this.textBox佣金.Text = productInfoVO.estimated_commission;
            this.textBox店铺评分.Text = productInfoVO.shop_expr_score;
            this.textBox总销量.Text = productInfoVO.sales;
            this.textBox带货视频.Text = productInfoVO.video_count;
            this.textBox热推达人.Text = productInfoVO.nearly_month_live_author_count;
            this.hyperLinkEdit抖音链接.Text = productInfoVO.url;
            this.pictureBox头图.Image = productInfoVO.imagePic;
            //  图片链接
            ChanmamaProductInfoOcrDescDTO chanmamaProductInfoOcrDescDTO = 
                圣同润Service.getChanmamaProductInfoOcrDesc(productId);
            foreach (String image in chanmamaProductInfoOcrDescDTO.buttomImages)
            {
                //  详情图列表
                this.pictureVOs.Add(new PictureVO("详情图片", image));
            }
            this.gridControl图片.DataSource = this.pictureVOs;
            this.tileView图片.RefreshData();
            //  评论
            List<ChanmamaProductCommentInfoDao> chanmamaProductCommentInfoDaos = 
                圣同润Service.getChanmamaProductCommentInfoAll(productId);
            this.gridControl评论.DataSource = chanmamaProductCommentInfoDaos;
            this.advBandedGridView1.RefreshData();
        }
    }
}